import {IReference} from "../Base/ReferencePool/IReference";
import {Sound_Constant} from "./Constant";
import {ReferencePool} from "../Base/ReferencePool/ReferencePool";

export class PlaySoundParams implements IReference {
    get referenced(): boolean {
        return this._referenced;
    }

    get time(): number {
        return this._time;
    }

    set time(value: number) {
        this._time = value;
    }

    get muteInSoundGroup(): boolean {
        return this._muteInSoundGroup;
    }

    set muteInSoundGroup(value: boolean) {
        this._muteInSoundGroup = value;
    }

    get loop(): boolean {
        return this._loop;
    }

    set loop(value: boolean) {
        this._loop = value;
    }

    get priority(): number {
        return this._priority;
    }

    set priority(value: number) {
        this._priority = value;
    }

    get volumeInSoundGroup(): number {
        return this._volumeInSoundGroup;
    }

    set volumeInSoundGroup(value: number) {
        this._volumeInSoundGroup = value;
    }

    get fadeInSeconds(): number {
        return this._fadeInSeconds;
    }

    set fadeInSeconds(value: number) {
        this._fadeInSeconds = value;
    }

    get pitch(): number {
        return this._pitch;
    }

    set pitch(value: number) {
        this._pitch = value;
    }

    get panStereo(): number {
        return this._panStereo;
    }

    set panStereo(value: number) {
        this._panStereo = value;
    }

    get spatialBlend(): number {
        return this._spatialBlend;
    }

    set spatialBlend(value: number) {
        this._spatialBlend = value;
    }

    get maxDistance(): number {
        return this._maxDistance;
    }

    set maxDistance(value: number) {
        this._maxDistance = value;
    }

    get dopplerLevel(): number {
        return this._dopplerLevel;
    }

    set dopplerLevel(value: number) {
        this._dopplerLevel = value;
    }

    private _referenced: boolean;
    private _time: number;
    private _muteInSoundGroup: boolean;
    private _loop: boolean;
    private _priority: number;
    private _volumeInSoundGroup: number;
    private _fadeInSeconds: number;
    private _pitch: number;
    private _panStereo: number;
    private _spatialBlend: number;
    private _maxDistance: number;
    private _dopplerLevel: number;

    constructor() {
        this._referenced = false;
        this._time = Sound_Constant.DefaultTime;
        this._muteInSoundGroup = Sound_Constant.DefaultMute;
        this._loop = Sound_Constant.DefaultLoop;
        this._priority = Sound_Constant.DefaultPriority;
        this._volumeInSoundGroup = Sound_Constant.DefaultVolume;
        this._fadeInSeconds = Sound_Constant.DefaultFadeInSeconds;
        this._pitch = Sound_Constant.DefaultPitch;
        this._panStereo = Sound_Constant.DefaultPanStereo;
        this._spatialBlend = Sound_Constant.DefaultSpatialBlend;
        this._maxDistance = Sound_Constant.DefaultMaxDistance;
        this._dopplerLevel = Sound_Constant.DefaultDopplerLevel;

    }

    public static Create(): PlaySoundParams {
        let playSoundParams: PlaySoundParams = ReferencePool.Acquire(PlaySoundParams);
        playSoundParams._referenced = true;
        return playSoundParams;

    }


    Clear(): void {
        this._time = Sound_Constant.DefaultTime;
        this._muteInSoundGroup = Sound_Constant.DefaultMute;
        this._loop = Sound_Constant.DefaultLoop;
        this._priority = Sound_Constant.DefaultPriority;
        this._volumeInSoundGroup = Sound_Constant.DefaultVolume;
        this._fadeInSeconds = Sound_Constant.DefaultFadeInSeconds;
        this._pitch = Sound_Constant.DefaultPitch;
        this._panStereo = Sound_Constant.DefaultPanStereo;
        this._spatialBlend = Sound_Constant.DefaultSpatialBlend;
        this._maxDistance = Sound_Constant.DefaultMaxDistance;
        this._dopplerLevel = Sound_Constant.DefaultDopplerLevel;
    }

}